package community.hospital.validation;

import community.hospital.annotation.CheckState;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import static community.hospital.common.Constant.STATE_DISABLE;
import static community.hospital.common.Constant.STATE_ENABLE;

/**
 * @author yindingjie
 */
public class StateValidation implements ConstraintValidator<CheckState,Integer> {

    @Override
    public boolean isValid(Integer value, ConstraintValidatorContext context) {
        return value!=null && (value.equals(STATE_ENABLE)||value.equals(STATE_DISABLE));
    }
}
